package cloud.xlh.my_system.utils.password_security;

import org.apache.commons.codec.binary.Base64;

import java.io.UnsupportedEncodingException;

/**
 * Created with IntelliJ IDEA.
 *
 * @ project name : xlh_osms
 * @ Author: XuLeHuang
 * @ Date: 2022/6/27 14:54
 * @ Description:
 */
public class DecodedRandomStringAndPasswordHelper {
    public static String getPasswordByEncodedString(String encodedString) throws UnsupportedEncodingException {
        byte[] originRandomStringAndPassword = AESUtil.AES_CBC_Decrypt(Base64.decodeBase64(encodedString) , EncodedRandomStringHelper.randomString.getBytes());
        System.out.println("AES解密的包含随机字符串和密码的加密字符串" + new String(originRandomStringAndPassword , "UTF-8"));
        String password = new String(originRandomStringAndPassword, "UTF-8").substring(16);
        System.out.println(password);
        return password;
    }
}
